package com.oasystem.web.controller.profit;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.oasystem.domain.Member;
import com.oasystem.service.DepartmentService;
import com.oasystem.service.GoodsService;
import com.oasystem.service.OperatorService;

@Controller
@RequestMapping(value = "/MainMenu/profit")
public class ProfitController {
	@Resource(name = "operatorService")
	private OperatorService operatorService;
	@Resource(name = "goodsService")
	private GoodsService goodsService;
	@Resource(name = "departmentService")
	private DepartmentService departmentService;

	@RequestMapping(value = "/addPage")
	public String addPage(Model model) {
		model.addAttribute("mainMenu", "profit");
		model.addAttribute("subMenu", "add");
		return "profit.addPage";
	}

	@RequestMapping(value = "/searchPage")
	public String searchPage(Model model) {
		model.addAttribute("mainMenu", "profit");
		model.addAttribute("subMenu", "search");
		model.addAttribute("member", new Member());
		model.addAttribute("operatorList",
				operatorService.getAllOperatorsWithoutPermission());
		model.addAttribute("goodsList", goodsService.getAllGoods());
		model.addAttribute("departmentList",
				departmentService.getAllDepartment());
		return "profit.searchPage";
	}

	@RequestMapping(value = "/summaryPage")
	public String summaryPage(Model model) {
		model.addAttribute("mainMenu", "profit");
		model.addAttribute("subMenu", "summary");
		return "profit.summaryPage";
	}
}
